#include <iostream>
#include <vector>
using namespace std;

int n, m;

int main() {
    while (cin >> n >> m)
    {
        vector<vector<int>> nums(n, vector<int>(m, 0));
        vector<long> row(n, 1), col(m, 1);
        vector<bool> rowz(n, false), colz(m, false);
        for (int i = 0; i < n; i++)
            for (int j = 0; j < m; j++)
            {
                cin >> nums[i][j];
                if (nums[i][j] == 0)
                {
                    rowz[i] = colz[j] = true;
                    nums[i][j] = -1;
                    continue;
                }
                row[i] *= nums[i][j];
                col[j] *= nums[i][j];
            }
        long res = 1;
        for (int i = 0; i < n; i++)
            for (int j = 0; j < m; j++)
            {
                if ((rowz[i] || colz[j]) && nums[i][j] != -1)
                    continue;
                res = max(res, row[i] * col[j] / (nums[i][j] * nums[i][j]));
            }
        cout << res << endl;
    }
    return 0;
}